﻿using System;
using System.Collections.Generic;

namespace ConsoleApplication_01
{
    internal class Program
    {
        
        public static void Main(string[] args)
        {
            Person person = new Person {Age = 30, Name = "1"};
            Rule textRule1 = new Rule(TextRule1, RuleTypes.Text, "Is an empty string?");
            Rule numericalRule1 = new Rule(NumericalRule1, RuleTypes.Numerical, "Number > 20?");
            List<Rule> textRules = new List<Rule>();
            List<Rule> numericalRules = new List<Rule>();
            textRules.Add(textRule1);
            numericalRules.Add(numericalRule1);
            Console.WriteLine(RulesChecker.Check(person.Age, numericalRules));
            Console.WriteLine(RulesChecker.Check(person.Name, textRules));
            Console.ReadLine();
        }

        private static bool TextRule1(object target)
        {
            string str = (string)target;
            if (str != null)
                if (!str.Equals("")) 
                    return false;
            return true;
        }

        private static bool NumericalRule1(object target)
        {
            int number = (int)target;
            return number > 20;
        }
    }
}
